package com.egg.demo.controller.web;

import com.egg.common.core.model.controller.WebController;
import com.egg.common.core.model.response.ResponseData;
import com.egg.demo.service.WebsocketService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 通知Controller
 * </p>
 */
@Slf4j
@Api(tags = WebController.API_PREFIX + "通知中心")
@RestController
@RequestMapping("/notification")
public class WebsocketController extends WebController {

    /* http://localhost:9400/websocket/index.html */

    @Autowired
    private WebsocketService websocketService;


    @ApiOperation(value = "总人数")
    @GetMapping("/user/total")
    public ResponseData<Integer> userTotal() {
        return ResponseData.success(websocketService.userTotal());
    }

    @ApiOperation(value = "在线人数")
    @GetMapping("/user/online")
    public ResponseData<Integer> userOnline() {
        return ResponseData.success(websocketService.userOnline());
    }


}
